package com.wkang.controller;

import com.wkang.pojo.User;
import com.wkang.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: wkang
 * @package: com.wkang.controller
 * @date: 2019/11/12
 * @version: ver1.0
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;

    @RequestMapping("/findAll")
    public List<User> findAll(){
        return userService.findAll();
    }

    @RequestMapping("/find/{id}")
    public User findUserById(@PathVariable(value = "id") Integer id){
        System.out.println("===========1111111111111111==========");
        return userService.findUserById(id);
    }
}
